package com.qf.bigdata.controller;

import com.qf.bigdata.bean.DauPredictInfo;
import com.qf.bigdata.service.PredictDAUService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.text.ParseException;

@Controller
@RequestMapping("/api/v1")
//@ResponseBody
public class DauController {

    @Autowired //自动装配
    private PredictDAUService predictDAUService;

    @RequestMapping("aaa")
    @ResponseBody
    public String aaa(){
        return "hello";
    }

    @RequestMapping(path="dau/{startDate}/{endDate}/{gap}/{scale}/{dnu}")
    @ResponseBody
    public DauPredictInfo predict(
            @PathVariable String startDate,
            @PathVariable String endDate,
            @PathVariable int gap,
            @PathVariable int scale,
            @PathVariable int dnu) throws ParseException {
        return predictDAUService.predict(startDate,endDate,gap,scale,dnu);
//        return startDate+","+endDate+","+gap;
    }

}
